// 导入vue-router工厂函数
import { createWebHashHistory, createRouter } from 'vue-router';
import { shallowRef } from 'vue';
import login from "../views/login/index.vue";
import Layout from "../layout/index.vue";
import notFind from '@/views/ErrorMessage/404.vue'

// 静态路由
export const constantRouter = [
	{
		path: "/login",
		name: login,
		hidden: true,
		component: login,
	},
	{
		path: '/:path(.*)',
		component: notFind,
		hidden: true,
	},
	// 首页
	{
		path: "/",
		component: Layout,
		redirect: "/dashboard",
		meta: { requiresAuth: true, title: "首页", icon: "home" },
		children: [
			{
				path: "dashboard",
				name: "dashboard",
				component: () => import("../views/home/index.vue"),
			},
		],
	},
	// 商品分类
	{
		path: "/shop",
		component: Layout,
		meta: { requiresAuth: true, title: "商品分类", icon: "shop" },
		children: [
			{
				path: "/list",
				name: "list",
				component: () => import("../views/shopCate/mainCate/index.vue"),
				meta: { requiresAuth: true, title: "主体分类", icon: "shop" },
			},
			{
				path: "/info",
				name: "info",
				component: () => import("../views/shopCate/info/index.vue"),
				meta: { requiresAuth: true, title: "分类详情", icon: "shop" },
			},
			{
				path: "/goodsInfo",
				name: "goodsInfo",
				component: () => import("../views/shopCate/goodsInfo/index.vue"),
				meta: { requiresAuth: true, title: "数据详情", icon: "shop" },
			},
			{
				path: "/product",
				name: "product",
				component: () => import("../views/shopCate/product/index.vue"),
				meta: { requiresAuth: true, title: "商品展示", icon: "shop" },
			},
		],
	},
	// 轮播图管理
	{
		path: "/slideshow",
		component: Layout,
		meta: { requiresAuth: true, title: "轮播图管理", icon: "shop" },
		children: [
			{
				path: "/item",
				name: "slideshow",
				component: () => import("@/views/slideshow/index.vue"),
			},
		],
	},
	// 栏目管理
	{
		path: "/column",
		component: Layout,
		meta: { requiresAuth: true, title: "栏目管理", icon: "shop" },
		children: [
			{
				path: "/part",
				name: "part",
				component: () => import("@/views/column/columntag/index.vue"),
				meta: { requiresAuth: true, title: "栏目分类" },
			},
			{
				path: "/details",
				name: "details",
				component: () => import("@/views/column/details/index.vue"),
				meta: { requiresAuth: true, title: "栏目信息" },
			},
		],
	},
]
const router = createRouter({
	history: createWebHashHistory(),
	routes: [...constantRouter]
});


export default router;
